:root {
  /* only change this if you aren't using the default pallete */
  --border-colour-: #e0e845;
  /* width of green border around screen (variable for desktop only, border width is fixed on mobile) 
     using a percentage for this value causes issues. If you're better at css than me then maybe you can fix it. */
  --border-width-: 20px;
}

body {
  background-color: black;
  color: #fff;
  font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue",
    Helvetica, Arial, "Lucida Grande", sans-serif;
  font-weight: 300;
  margin: 0;
  padding: 0;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

#holder {
  height: 100vh;
  background-color: var(--border-colour-);
  padding: var(--border-width-);
  padding-left: calc((var(--border-width-) / 144) * 160);
  padding-right: calc((var(--border-width-) / 144) * 160);

  box-sizing: border-box;
  background-image: url("../Images/Noise texture.png");

}

#game {
  display: flex;
  flex-direction: column;
  position: absolute;
  width: 100%;
  height: 100%;
  touch-action: none;
  justify-content: space-around;
}

#container {
  margin: auto;
  box-sizing: border-box;
}

#game canvas {
  object-fit: contain;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  height: 100%;
  opacity: 85%;
  /* filter: blur(0.4px); */
}

#bkg {
  position: absolute;
  aspect-ratio: 160/144;
  background-image: url("../Images/DMG pixel grid desktop.png");
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 100;
  opacity: 30%;
  height: calc(100vh - (var(--border-width-) * 2));
  width: auto;
  z-index: 100;
}

#Nintendo {
  margin-left: 15px;
  color: #042531;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: 1.5em;
  padding-top: 0;
  margin-top: 0;
}

#gameboy {
  color: #042531;
  font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
  font-size: 2em;
  padding-top: 0;
  margin-top: 0;
  font-style: italic;
  font-weight: normal;
}

#controller {
  display: none;
  position: relative;
  /* position: fixed; */
  /* bottom: 0px; */
  height: 260px;
  width: 100%;
  touch-action: none;
  opacity: 0.8;
}

#controller_dpad {
  position: absolute;
  bottom: 75px;
  left: 0px;
  width: 184px;
  height: 184px;
  background: radial-gradient(ellipse at center, #6c6c6c 0%, #dddfd400 70%);
}

#controller_dpad:before {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  background: #111111;
  background: radial-gradient(ellipse at center,
      #111111 0%,
      #080808 59%,
      #111111 60%);
  position: absolute;
  left: 68px;
  top: 68px;
}

#controller_left {
  position: absolute;
  left: 20px;
  top: 68px;
  width: 48px;
  height: 48px;
  background: #666;
  background: radial-gradient(ellipse at center, #272727 0%, #111111 80%);
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

#controller_right {
  position: absolute;
  left: 116px;
  top: 68px;
  width: 48px;
  height: 48px;
  background: #666;
  background: radial-gradient(ellipse at center, #272727 0%, #111111 80%);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

#controller_up {
  position: absolute;
  left: 68px;
  top: 20px;
  width: 48px;
  height: 48px;
  background: #666;
  background: radial-gradient(ellipse at center, #272727 0%, #111111 80%);
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

#controller_down {
  position: absolute;
  left: 68px;
  top: 116px;
  width: 48px;
  height: 48px;
  background: #666;
  background: radial-gradient(ellipse at center, #272727 0%, #111111 80%);
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

#controller_a {
  position: absolute;
  bottom: 155px;
  right: 20px;
}

#controller_b {
  position: absolute;
  bottom: 125px;
  right: 100px;
}

.roundBtn {
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 32px;
  color: #00000000;
  line-height: 64px;
  width: 64px;
  height: 64px;
  border-radius: 64px;
  background: #870a4c;
  background: radial-gradient(ellipse at center, #b01163 0%, #880f2b 100%);
  box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.2);
}

.capsuleBtn {
  font-weight: bold;
  font-size: 10px;
  color: #111;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 40px;
  text-transform: uppercase;
  width: 64px;
  height: 32px;
  border-radius: 40px;
  background: #222;
  background: radial-gradient(ellipse at center, #666 0%, #565656 100%);
  box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.2);
}

.buttonlabel {
  position: relative;
  top: 45px;
  left: 10px;
  color: rgb(11, 1, 48);
  transform: rotate(-17deg);
  font-size: 0.6em;
}

.selectlabel {
  position: relative;
  top: 30px;
  right: 15px;
  color: rgb(11, 1, 48);
}

#controller_start {
  position: absolute;
  color: #00000000;
  bottom: 40px;
  right: 30%;
  transform: rotate(-30deg);
}

#controller_select {
  position: absolute;
  color: #00000000;
  bottom: 40px;
  right: 50%;
  transform: rotate(-30deg);
}

.btnPressed {
  opacity: 0.5;
}




.spinner {
  height: 50px;
  width: 50px;
  margin: 0px auto;
  -webkit-animation: rotation 0.8s linear infinite;
  -moz-animation: rotation 0.8s linear infinite;
  -o-animation: rotation 0.8s linear infinite;
  animation: rotation 0.8s linear infinite;
  border-left: 10px solid #306850;
  border-right: 10px solid #306850;
  border-bottom: 10px solid #306850;
  border-top: 10px solid #88c070;
  border-radius: 100%;
  background-color: #031921;
}

@-webkit-keyframes rotation {
  from {
    -webkit-transform: rotate(0deg);
  }

  to {
    -webkit-transform: rotate(360deg);
  }
}

@-moz-keyframes rotation {
  from {
    -moz-transform: rotate(0deg);
  }

  to {
    -moz-transform: rotate(360deg);
  }
}

@-o-keyframes rotation {
  from {
    -o-transform: rotate(0deg);
  }

  to {
    -o-transform: rotate(360deg);
  }
}

@keyframes rotation {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media only screen and (max-width: 640px) {

  #container {
    margin: 0;
  }

  #game canvas {
    margin-top: 0px;
    width: 100%;
    max-width: 512px;
    border: 0px;
    border-radius: 0px;


  }

  body {
    background: #dddfd4;
    background-image: url("../Images/Noise texture.png");
    background-size: 100%;
  }

  #holder {
    width: auto;
    height: fit-content;
    border: 45px solid #666;
    padding: 10px;
    border-radius: 1em;
    border-bottom-right-radius: 2.5em;
    border-top: solid 25px #666;
    border-bottom: solid 25px #666;

    margin: 10px;
  }

  #bkg {
    position: absolute;
    aspect-ratio: 160/144;
    /* image has less detail which works better on smaller screens */
    background-image: url("../Images/DMG pixel grid mobile.png");
    background-size: contain;
    z-index: 100;
    opacity: 30%;
    height: auto;
    z-index: 100;

    left: 65px;
    right: 65px;


  }


  #game-border {
    border-bottom: 30px solid #666;
  }

  #logo,
  #logotext {
    position: relative;
    font-size: 1.8em;
    color: rgb(11, 1, 48);
    font-weight: bold;
    margin: 10px;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    opacity: 80%;
  }
}

@media only screen and (max-device-width: 812px) and (orientation: portrait) {
  body {
    margin: 0;
  }

  #game {
    width: 100%;
    position: fixed;
    touch-action: none;
  }

  #game canvas {
    margin: 0;
    display: block;
    width: 100% !important;
    height: auto !important;
  }

}

@media only screen and (max-device-width: 320px) and (orientation: portrait) {
  #controller_dpad {
    left: -5px;
    bottom: -5px;
  }

  #controller_a {
    right: 5px;
    bottom: 95px;
  }

  #controller_b {
    right: 80px;
  }

  #controller_start {
    right: 5px;
  }

  #controller_select {
    right: 80px;
  }
}

@media only screen and (max-width: 500px) and (max-height: 400px) {
  #controller {
    display: none;
  }
}

/* Small devices in landscape */
@media only screen and (max-device-width: 300px) and (orientation: landscape) {

  html,
  body {
    height: 100%;
  }

  body {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #game:after {
    content: "PLEASE ROTATE ↻";
    font-size: 24px;
    font-weight: bold;
    color: #fff;
  }

  #game canvas {
    display: none;
    max-width: 480px;
  }

  #controller {
    display: none;
  }
}

/* Devices large enough for landscape */
@media only screen and (min-width: 300px) and (orientation: landscape) {
  #controller {
    bottom: 50%;
    transform: translateY(50%);
    opacity: 0.5;
  }
}

#debug {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  position: fixed;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
  background: rgba(0, 0, 0, 0.5);
}

#debug div {
  background: white;
  color: black;
  border: 1px solid #ddd;
  border-radius: 4px;
  transform: position;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  display: flex;
  align-items: center;
}

#debug span {
  padding: 5px 8px;
}

#debug button {
  background: transparent;
  border: none;
  border-left: 1px solid #ddd;
  display: flex;
  align-items: center;
  height: 100%;
}

#debug button:hover {
  background: #eee;
}

#debug button:active {
  background: #ddd;
}